package com.ruoyi.documents.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.documents.domain.DocXmjl;
import com.ruoyi.documents.service.IDocXmjlService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 项目经理人员信息Controller
 * 
 * @author ruoyi
 * @date 2023-12-18
 */
@RestController
@RequestMapping("/documents/xmjl")
public class DocXmjlController extends BaseController
{
    @Autowired
    private IDocXmjlService docXmjlService;

    /**
     * 查询项目经理人员信息列表
     */
    @PreAuthorize("@ss.hasPermi('documents:xmjl:list')")
    @GetMapping("/list")
    public TableDataInfo list(DocXmjl docXmjl)
    {
        startPage();
        List<DocXmjl> list = docXmjlService.selectDocXmjlList(docXmjl);
        return getDataTable(list);
    }

    /**
     * 导出项目经理人员信息列表
     */
    @PreAuthorize("@ss.hasPermi('documents:xmjl:export')")
    @Log(title = "项目经理人员信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DocXmjl docXmjl)
    {
        List<DocXmjl> list = docXmjlService.selectDocXmjlList(docXmjl);
        ExcelUtil<DocXmjl> util = new ExcelUtil<DocXmjl>(DocXmjl.class);
        util.exportExcel(response, list, "项目经理人员信息数据");
    }

    /**
     * 获取项目经理人员信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('documents:xmjl:query')")
    @GetMapping(value = "/{xmjlId}")
    public AjaxResult getInfo(@PathVariable("xmjlId") Long xmjlId)
    {
        return success(docXmjlService.selectDocXmjlByXmjlId(xmjlId));
    }

    /**
     * 新增项目经理人员信息
     */
    @PreAuthorize("@ss.hasPermi('documents:xmjl:add')")
    @Log(title = "项目经理人员信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DocXmjl docXmjl)
    {
        return toAjax(docXmjlService.insertDocXmjl(docXmjl));
    }

    /**
     * 修改项目经理人员信息
     */
    @PreAuthorize("@ss.hasPermi('documents:xmjl:edit')")
    @Log(title = "项目经理人员信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DocXmjl docXmjl)
    {
        return toAjax(docXmjlService.updateDocXmjl(docXmjl));
    }

    /**
     * 删除项目经理人员信息
     */
    @PreAuthorize("@ss.hasPermi('documents:xmjl:remove')")
    @Log(title = "项目经理人员信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{xmjlIds}")
    public AjaxResult remove(@PathVariable Long[] xmjlIds)
    {
        return toAjax(docXmjlService.deleteDocXmjlByXmjlIds(xmjlIds));
    }

    /**
     * 查询全部项目经理信息列表
     */
    @PreAuthorize("@ss.hasPermi('documents:xmjl:list')")
    @GetMapping("/listAll")
    public AjaxResult listAll(DocXmjl docXmjl)
    {
        List<DocXmjl> list = docXmjlService.selectDocXmjlList(docXmjl);
        return success(list);
    }
}
